package com.kee.server.manager.job;

import java.sql.SQLException;

import com.kee.common.util.RegxUtil;
import com.kee.server.dao.ExamDao;
import com.kee.server.dao.IExamDao;
import com.kee.server.manager.service.DataHandler;
import com.kee.server.manager.service.PushChoice;
import com.kee.server.manager.service.PushPlugin;
import com.kee.share.bean.Exam;

public class ImportDataJob extends Thread {
	
	private final static IExamDao examDao = new ExamDao();
	
	private final static int CHANNEL_ID = 75;
	
	@Override
	public void run() {
		int startId = 7888;
		int endId = 14281;
		for (int i = startId; i <= endId;i++){
		Exam exam;
		try {
			exam = examDao.query(i);
				if (exam != null && exam.getWebsite() == 2) {
					PushPlugin plugin = new PushChoice(exam);
					DataHandler handler = new DataHandler(plugin);
					handler.push(CHANNEL_ID, 1, 1, 9, exam);
					exam.setStatus(1);
					examDao.update(exam);
					System.out.println(i);
				}
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (Exception e1) {
			e1.printStackTrace();
		}
		}
	}
	
	
	public static void main(String[] args) {
		ImportDataJob data = new ImportDataJob();
		data.start();
	}
}
